import { axios } from '@/utils/request'

const api = {
  // 数据展示
  getSupplierCodeCount: '/supplier/info/getSupplierCodeCount',
  getSupplierTypeNum: '/supplier/info/getSupplierTypeNum',
  getSupplierEntryNum: '/supplier/info/getSupplierEntryNum',
  getSupplierBadNum: '/supplier/info/getSupplierBadNum',

  saveOnlyUploads: '/uploads/saveOnlyUploads', // 附件单文件上传
  idcardFrontUpload: '/uploads/saveIdcardFront',
  idcardBackUpload: '/uploads/saveIdcardBack',
  businessLicenseUpload: '/uploads/saveBusinessLicense',
  deleteUploadPic: '/uploads/deleteFile',
  // 供应商信息
  getHisDrugDir: '/supplier/info/getHisDrugDir', // 药品
  getHisMaterialDir: '/supplier/info/getHisMaterialDir', // 物资
  allLinkInfo: '/supplier/info/querySupplierCode',
  querySupplierName: '/supplier/info/querySupplierName',
  getHisInboundPay: '/supplier/info/getHisInboundPay',
  // : '/supplier/info/querySupplierType',
  ownLinkInfo: '/supplier/info/queryAll',
  getSupplierInfoByCode: '/supplier/info/getSupplierInfo',
  supplierInfoList: '/supplier/info/querySupplierInfoAll',
  supplierDetail: '/supplier/info/querySupplierInfoById',
  updateSupplierInfo: '/supplier/info/updateSupplierInfo', // 供应商信息变更
  updateSupplierInfoAll: '/supplier/info/updateSupplierInfoAll', // 编辑供应商信息
  insertSupplierInfoType: '/supplier/info/insertSupplierInfoType', // 新增供应商类型
  insertSupplierInfo: '/supplier/info/insertSupplierInfo',
  getSupplierCodeType: '/supplier/info/getSupplierCodeType', // 查询供应商类型
  querySupplierInfoByDeptId: '/supplier/info/querySupplierInfoByDeptId', // 准入列表
  querySupplierType: '/supplier/info/querySupplierType', // 查询供应商选择时候的类型
  saveSupplierDir: '/supplier/contract/saveSupplierDir',
  // 
  accessoryDetail: '/supplier/accessory/querySupplierAccessory',
  insertSupplierAccessory: '/supplier/accessory/insertSupplierAccessory',
  // 联系人
  linkmanDetail: '/supplier/linkman/querySupplierLinkmanById',
  allLinkMan: '/supplier/linkman/queryAll',
  linkmanList: '/supplier/linkman/querySupplierLinkman',
  insertLinkMan: '/supplier/linkman/insertSupplierLinkmanInfo',
  updateLinkMan: '/supplier/linkman/updateSupplierLinkmanInfo',
  deleteLinkMan: '/supplier/linkman/deleteSupplierLinkmanInfo',
  showUrlById: '/supplier/linkman/getSaveUrl',
  getOneUrl: '/supplier/linkman/getOneUrl',
  // 不良记录
  badSupplierList: '/supplier/bad/querySupplierBad',
  insertBad: '/supplier/bad/insertSupplierBad',
  updateBad: '/supplier/bad/updateSupplierBad',
  badDetail: '/supplier/bad/querySupplierBadById',
  updateSupplierEntry: '/supplier/entry/updateSupplierEntry', // 准入
  handleBadRecord: '/supplier/bad/managementSupplierBad',
  getSupplierEntryAll: '/supplier/info/getSupplierEntryAll',
  resumeRecord: '/supplier/bad/cancelSupplierPurchase',
  // 合同管理
  getContract: '/supplier/contract/page',
  deleteContract: '/supplier/contract/delete',
  updateContract: '/supplier/contract/update',
  createContract: '/supplier/contract/create',
  searchSupplier: '/supplier/contract/all',
}

export function resumeRecord(data) {
  return axios({
    url: api.resumeRecord,
    method: 'put',
    data
  })
}

// getSupplierEntryAll
export function getSupplierEntryAll(params) {
  return axios({
    url: api.getSupplierEntryAll,
    method: 'get',
    params
  })
}

// saveSupplierDir
export function saveSupplierDir(params) {
  return axios({
    url: api.saveSupplierDir,
    method: 'get',
    params
  })
}

// getSupplierCodeType
export function getSupplierCodeType(params) {
  return axios({
    url: api.getSupplierCodeType,
    method: 'get',
    params
  })
}

// getHisInboundPay
export function getHisInboundPay(params) {
  return axios({
    url: api.getHisInboundPay,
    method: 'get',
    params
  })
}

// searchSupplier
export function searchSupplier(params) {
  return axios({
    url: api.searchSupplier,
    method: 'get',
    params
  })
}

export function updateContract(data) {
  return axios({
    url: api.updateContract,
    method: 'put',
    data
  })
}

export function createContract(data) {
  return axios({
    url: api.createContract,
    method: 'post',
    data
  })
}

// deleteContract
export function deleteContract(id, params = {}) {
  return axios({
    url: `${api.deleteContract}/${id}`,
    method: 'get',
    params
  })
}

export function getContract(params) {
  return axios({
    url: api.getContract,
    method: 'get',
    params
  })
}

// getSupplierCodeCount
export function getSupplierCodeCount(params) {
  return axios({
    url: api.getSupplierCodeCount,
    method: 'get',
    params
  })
}

// getHisDrugDir
export function getHisDrugDir(params) {
  return axios({
    url: api.getHisDrugDir,
    method: 'get',
    params
  })
}

export function getHisMaterialDir(params) {
  return axios({
    url: api.getHisMaterialDir,
    method: 'get',
    params
  })
}

export function getSupplierTypeNum(params) {
  return axios({
    url: api.getSupplierTypeNum,
    method: 'get',
    params
  })
}

export function getSupplierEntryNum(params) {
  return axios({
    url: api.getSupplierEntryNum,
    method: 'get',
    params
  })
}

// getSupplierBadNum
export function getSupplierBadNum(params) {
  return axios({
    url: api.getSupplierBadNum,
    method: 'get',
    params
  })
}

// querySupplierName
export function querySupplierName(params) {
  return axios({
    url: api.querySupplierName,
    method: 'get',
    params
  })
}

// 附件单文件上传
export function saveOnlyUploads(parameter) {
  return axios({
    url: api.saveOnlyUploads,
    method: 'post',
    data: parameter
  })
}

// 身份证正面上传
export function idcardFrontUpload(parameter) {
  return axios({
    url: api.idcardFrontUpload,
    method: 'post',
    data: parameter
  })
}

// 身份证反面上传
export function idcardBackUpload(parameter) {
  return axios({
    url: api.idcardBackUpload,
    method: 'post',
    data: parameter
  })
}

// 营业资格证上传
export function businessLicenseUpload(parameter) {
  return axios({
    url: api.businessLicenseUpload,
    method: 'post',
    data: parameter
  })
}

// 删除图片
export function deleteUploadPic(id, parameter) {
  return axios({
    url: `${api.deleteUploadPic}/${id}`,
    method: 'delete',
    params: parameter
  })
}

// 编辑供应商通过id查看
export function getSupplierInfoByCode(code, parameter) {
  return axios({
    url: `${api.getSupplierInfoByCode}/${code}`,
    method: 'get',
    params: parameter
  })
}

// 供应商-供应商信息列表
export function supplierInfoList(parameter) {
  return axios({
    url: api.supplierInfoList,
    method: 'get',
    params: parameter
  })
}

// 供应商-点名称查供应商详情
export function supplierDetail(parameter) {
  return axios({
    url: api.supplierDetail,
    method: 'get',
    params: parameter
  })
}

// 供应商信息变更
export function updateSupplierInfo(parameter) {
  return axios({
    url: api.updateSupplierInfo,
    method: 'put',
    data: parameter
  })
}

// 更新供应商所有信息
export function updateSupplierInfoAll(parameter) {
  return axios({
    url: api.updateSupplierInfoAll,
    method: 'put',
    data: parameter
  })
}

// 新增供应商所有信息
export function insertSupplierInfo(parameter) {
  return axios({
    url: api.insertSupplierInfo,
    method: 'post',
    data: parameter
  })
}

// 新增供应商类型
export function insertSupplierInfoType(parameter) {
  return axios({
    url: api.insertSupplierInfoType,
    method: 'post',
    data: parameter
  })
}

// 供应商-业务员详情信息
export function linkmanDetail(id, parameter) {
  return axios({
    url: `${api.linkmanDetail}/${id}`,
    method: 'get',
    params: parameter
  })
}

// 供应商-附件管理
export function accessoryDetail(parameter) {
  return axios({
    url: api.accessoryDetail,
    method: 'get',
    params: parameter
  })
}

// 供应商-新增附件管理
export function insertSupplierAccessory(parameter) {
  return axios({
    url: api.insertSupplierAccessory,
    method: 'post',
    data: parameter
  })
}

// 供应商-联系人维护
export function linkmanList(parameter) {
  return axios({
    url: api.linkmanList,
    method: 'get',
    params: parameter
  })
}

// 供应商-新增联系人
export function insertLinkMan(parameter) {
  return axios({
    url: api.insertLinkMan,
    method: 'post',
    data: parameter
  })
}

// 供应商-编辑联系人
export function updateLinkMan(parameter) {
  return axios({
    url: api.updateLinkMan,
    method: 'put',
    data: parameter
  })
}

// 供应商-根据ID显示图片
export function showUrlById(id, parameter) {
  return axios({
    url: `${api.showUrlById}/${id}`,
    method: 'get',
    params: parameter
  })
}

// 供应商-根据ID显示身份证和购销证
export function getOneUrl(id, parameter) {
  return axios({
    url: `${api.getOneUrl}/${id}`,
    method: 'get',
    params: parameter
  })
}

// 供应商-删除联系人
export function deleteLinkMan(id, parameter) {
  return axios({
    url: `${api.deleteLinkMan}/${id}`,
    method: 'delete',
    params: parameter
  })
}

// 供应商-不良记录列表
export function badSupplierList(parameter) {
  return axios({
    url: api.badSupplierList,
    method: 'get',
    params: parameter
  })
}

// 不良记录-查询所有联系人
export function allLinkInfo(parameter) {
  return axios({
    url: api.allLinkInfo,
    method: 'get',
    params: parameter
  })
}

// 不良记录-查询现有联系人 ownLinkInfo
export function ownLinkInfo(parameter) {
  return axios({
    url: api.ownLinkInfo,
    method: 'get',
    params: parameter
  })
}

// 不良记录-查询所有联系人
export function allLinkMan(parameter) {
  return axios({
    url: api.allLinkMan,
    method: 'get',
    params: parameter
  })
}

// 供应商-新增不良记录
export function insertBad(parameter) {
  return axios({
    url: api.insertBad,
    method: 'post',
    data: parameter
  })
}

// 供应商-修改不良记录
export function updateBad(parameter) {
  return axios({
    url: api.updateBad,
    method: 'put',
    data: parameter
  })
}

// 供应商-不良记录详情
export function badDetail(id, parameter) {
  return axios({
    url: `${api.badDetail}/${id}`,
    method: 'get',
    params: parameter
  })
}

// 供应商准入列表 querySupplierInfoByDeptId
export function querySupplierInfoByDeptId(parameter) {
  return axios({
    url: api.querySupplierInfoByDeptId,
    method: 'get',
    params: parameter
  })
}

// 供应商准入 updateSupplierEntry
export function updateSupplierEntry(parameter) {
  return axios({
    url: api.updateSupplierEntry,
    method: 'put',
    data: parameter
  })
}

// 不良记录处置 handleBadRecord
export function handleBadRecord(parameter) {
  return axios({
    url: api.handleBadRecord,
    method: 'put',
    data: parameter
  })
}

// 新增供应商时的选择类型
export function querySupplierType(parameter) {
  return axios({
    url: api.querySupplierType,
    method: 'get',
    params: parameter
  })
}